package com.shiro.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shiro.web.model.Json;
import com.shiro.web.model.User;
import com.shiro.web.service.UserService;

@Controller
@RequestMapping("user")
public class UserController {

	@Autowired
	private UserService userService;
	
	@RequestMapping("add")
	@ResponseBody
	public Json add(User user) {
		Json json = new Json();
		json.setMsg("进入添加用户方法");
		json.setObj(user);
		json.setSuccess(true);
		return json;
	}
	
	@RequestMapping("view")
	@ResponseBody
	public Json view() {
		Json json = new Json();
		json.setObj(userService.query());
		return json;
	}
	
	@RequestMapping("delete")
	@ResponseBody
	public Json delete() {
		Json json = new Json();
		json.setMsg("进入删除用户方法");
		return json;
	}
}
